#include "Scene04.hpp"

Scene04::Scene04() {
    this->setMessage("Okay, I will let you continue. See you later");

    b2Vec2 vertices[14];
    vertices[0].Set(-7.2f, -4.0f);
    vertices[1].Set(-2.2f, -4.0f);
    vertices[2].Set(-2.2f, -3.5f);
    vertices[3].Set(-0.5f, -3.5f);
    vertices[4].Set(-0.5f, -4.0f);
    vertices[5].Set(3.2f, -4.0f);
    vertices[6].Set(3.2f, 0.0f);
    vertices[7].Set(7.2f, 0.0f);
    vertices[8].Set(7.2f, 2.0f);
    vertices[9].Set(5.2f, 2.0f);
    vertices[10].Set(5.2f, 4.0f);
    vertices[11].Set(-5.2f, 4.0f);
    vertices[12].Set(-5.2f, -2.0f);
    vertices[13].Set(-7.2f, -2.0f);

    this->createRoom(4, vertices, 14);

    b2Vec2 platformVertices[2];
    platformVertices[0].Set(-5.2f, 0.0f);
    platformVertices[1].Set(-2.2f, 0.0f);

    this->createPlatform(platformVertices, 2);

    this->start = this->createDoor(-5.2f, -3.0f, -1.0f);
    this->createExit(6.2f, 1.0f);
    this->hero = this->createHero(-7.2f + HeroElement::WIDTH / 2.0f, -4.0f + HeroElement::HEIGHT / 2.0f);

    // Light to get the box.
    SpotlightElement* boxLight = this->createSpotlight(-0.5f, 3.5f, 5.0f * b2_pi / 4.0f, b2_pi / 6.0f, 9.0f, LightElement::attractiveLight);
    this->createSwitch(0.35f, -4.0f, 0.0f, boxLight);

    // Box to go to the exit.
    this->exit = this->createDoor(5.2f, 1.0f, 1.0f);
    SpotlightElement* exitLight = this->createSpotlight(2.7f, 3.65f, 3.0f * b2_pi / 2.0f, b2_pi / 6.0f, 8.0f, LightElement::attractiveLight);
    this->createSwitch(-1.35f, -3.5f, 0.0f, this->exit)->addActionableElement(exitLight);
    this->createBox(-4.0f, 0.5f);
}
